package com.syh.jn.scm.domain.supplier.entity.base;

import cn.redscarf.commons.util.bean.ExtBeanUtils;
import cn.redscarf.commons.util.other.ExtAssert;
import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.jn.scm.domain.support.SuperBusinessAggregate;
import com.syh.jn.scm.dto.supplier.base.invoiceInfo.InvoiceInfoMto;
import com.syh.jn.scm.dto.supplier.base.invoiceInfo.InvoiceInfoSto;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.UUID;

/**
 * 开票人基本信息
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SupplierInvoiceInfo extends SuperBusinessAggregate<Long> {
  /**
   * 新增开票人基本信息
   *
   * @param sto
   * @return
   */
  public static SupplierInvoiceInfo createTicketBasicInfo(InvoiceInfoSto sto) {
    ExtAssert.notNull(sto, "对象为空");
    ValidationUtils.validate(sto);
    SupplierInvoiceInfo basicInfo = new SupplierInvoiceInfo();
    ExtBeanUtils.copyProperties(sto, basicInfo);
    basicInfo.createTimeStamp = System.currentTimeMillis();
    basicInfo.setUuid(UUID.randomUUID().toString());
    return basicInfo;
  }

  /**
   * 修改
   *
   * @param mto
   */
  public void modify(InvoiceInfoMto mto) {
    ExtAssert.notNull(mto, "对象为空");
    ValidationUtils.validate(mto);
    ExtBeanUtils.copyProperties(mto, this);
    this.lastUpdateTimeStamp = System.currentTimeMillis();
  }

  /**
   * 数据销毁
   */
  public void destroy() {

  }

  /**
   * 公司名称
   */
  private String companyName;
  /**
   * 收款银行
   */
  private String bankName;
  /**
   * 银行账户
   */
  private String bankAccount;
  /**
   * 纳税人识别号
   */
  private String taxpayerCode;
  /**
   * 收票人
   */
  private String ticketCollector;
  /**
   * 联系电话
   */
  private String mobilePhone;
  /**
   * 地址 省 市 区
   */
  private String area;
  /**
   * 收票地址
   */
  private String address;
}
